{template 'common/header'}
<div class="panel panel-cut" id="js-account-display" ng-controller="AccountDisplay" ng-cloak>
	<div class="panel-heading">
		<span class="panel-heading-left"><i class="wi wi-wechat" style="font-size: 24px; margin-right: 10px; vertical-align:middle;"></i>请选择您要操作的公众号</span>
		<div class="font-default pull-right">
			
			
				{if !empty($account_info['uniacid_limit']) || $_W['isfounder']}
				<a href="./index.php?c=account&a=post-step" class="color-default"><i class="fa fa-plus"></i>新增公众号</a>
				{/if}
			
			{if $state == ACCOUNT_MANAGE_NAME_FOUNDER || $state == ACCOUNT_MANAGE_NAME_MANAGER}
			<a href="{php echo url('account/manage', array('account_type' => ACCOUNT_TYPE_OFFCIAL_NORMAL))}" class="color-default"><i class="wi wi-wechatstatistics"></i>公众号管理</a>
			{/if}
		</div>
	</div>
	<div class="panel-body" >
		{if !$_W['isfounder'] && !empty($account_info['uniacid_limit'])}
			<div class="alert alert-warning hidden">
				温馨提示：
				<i class="fa fa-info-circle"></i>
				Hi，<span class="text-strong">{$_W['username']}</span>，您所在的会员组： <span class="text-strong">{$account_info['group_name']}</span>
				账号有效期限：<span class="text-strong">{php echo date('Y-m-d', $_W['user']['starttime'])} ~~ {if empty($_W['user']['endtime'])}无限制{else}{php echo date('Y-m-d', $_W['user']['endtime'])}{/if}</span>，
				可创建 <span class="text-strong">{$account_info['maxaccount']} </span>个公众号，已创建<span class="text-strong"> {$account_info['uniacid_num']} </span>个，还可创建 <span class="text-strong">{$account_info['uniacid_limit']} </span>个公众号。
			</div>
		{/if}
		<div class="cut-header" ng-if="searchShow">
			<form action="./index.php" method="get">
				<input type="hidden" name="c" value="account">
				<input type="hidden" name="a" value="display">
				
				<input type="text" name="letter" ng-model="activeLetter" ng-style="{'display': 'none'}">
				<div class="cut-search">
					<div class="input-group pull-left">
						<input class="form-control" name="keyword" value="{$_GPC['keyword']}" type="text" placeholder="请输入微信公众号名称" >
						<span class="input-group-btn"><button class="btn btn-default button"><i class="fa fa-search"></i></button></span>
					</div>
				</div>
			</form>
		</div>
		<div class="clearfix"></div>
		<ul class="letters-list cut-wechat-letters" ng-if="searchShow">
			<li ng-repeat="letter in alphabet" ng-style="{'background-color': letter == activeLetter ? '#ddd' : 'none'}" ng-class="{'active': letter == activeLetter}" ng-click="searchModule(letter)">
				<a href="javascript:;" ng-bind="letter"></a>
			</li>
		</ul>
		<div class="cut-list clearfix" ng-if="accountList" infinite-scroll='loadMore()' infinite-scroll-disabled='busy' infinite-scroll-distance='0' infinite-scroll-use-document-bottom="true">
			<div class="item" ng-repeat="detail in accountList">
				<div class="content">
					<img ng-src="{{detail.logo}}" class="icon-account" onerror="this.src='./resource/images/nopic-107.png'"/>
					<div class="name" ng-bind="detail.name"></div>
					<div class="type">
						<span ng-if="detail.level == 1">类型：普通订阅号</span>
						<span ng-if="detail.level == 2">类型：普通服务号</span>
						<span ng-if="detail.level == 3">类型：认证订阅号</span>
						<span ng-if="detail.level == 4">类型：认证服务号</span>
					</div>
				</div>
				<div class="mask">
					<a ng-href="{{detail.switchurl}}" class="entry">
						<div>进入公众号 <i class="wi wi-angle-right"></i></div>
					</a>
					{if !permission_check_account_user('see_user_profile_account_num')}
					<a ng-href="{{links.welcome}}uniacid={{detail.uniacid}}" onclick="return ajaxopen(this.href);" class="home-show" title="添加到首页常用功能">
						<i class="wi wi-eye"></i>
					</a>
					{/if}
					<a href="javascript:;" class="stick" ng-click="stick(detail.uniacid)" title="置顶">
						<i class="wi wi-stick-sign"></i>
					</a>
				</div>
			</div>
		</div>
		<ul ng-if="!accountList" style="text-align:center;width:100%"><span ng-if="!accountList">暂无数据</span></ul>
	</div>	
</div>
<script>
	angular.module('accountApp').value('config', {
		accountList: {php echo !empty($account_list) ? json_encode($account_list) : 'null'},
		accountTotal: "{$total}",
		pagesize: "{$psize}",
		links: {
			rank: "{php echo url('account/display/rank')}",
			display: "{php echo url('account/display/display')}",
			welcome: "{php echo url('home/welcome/add_welcome')}",
		},
		scrollUrl : "{php echo url('account/display')}",
		keyword : "{$keyword}",
		letter : "{$letter}"
	});
	angular.bootstrap($('#js-account-display'), ['accountApp']);
</script>
{template 'common/footer'}